<template>
  <div class="app-container">
    <div class="header">
      <div class="title1">
        <i class="el-icon-data-analysis"></i><span>小海智达数据中心-市配</span>
      </div>
      <div class="backB">
        <img src="@/assets/images/back.png" alt="" @click="goBack" />
      </div>
    </div>
    <div class="formCenter">
      <!-- <el-form
          :model="queryParams"
          size="large"
          :inline="true"
          ref="queryForm"
          label-width="90px"
        >
          <el-form-item label="复核台号:" prop="areaNo">
            <el-input
              v-model="queryParams.areaNo"
              placeholder="请输入复核台号"
              clearable
            />
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="medium"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-search"
              size="medium"
              @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form> -->
    </div>
    <div class="content" v-loading="loading">
      <div class="marketTitle">小海智达数据中心-市配</div>
      <div class="taskOrder">
        <div class="oderItem">
          <div class="topItem">
            <div class="ordertitle">剩任务总订单数</div>
            <div class="orderSize">{{ taskSum }}</div>
          </div>
          <div class="topItem">
            <div class="ordertitle">总可配订单数</div>
            <div class="orderSize" @click="handleSum">{{ zrsum }}</div>
          </div>
        </div>
        <div class="oderItem">
          <div class="topItem">
            <div class="ordertitle">昨日待配</div>
            <div class="orderSize">{{ zrdp }}</div>
          </div>
          <div class="topItem">
            <div class="ordertitle">昨日可配</div>
            <div class="orderSize" @click="handleYesavailable">
              {{ zrwfhover }}
            </div>
          </div>
        </div>
        <div class="oderItem">
          <div class="topItem">
            <div class="ordertitle">今日待配</div>
            <div class="orderSize">{{ jrdp }}</div>
          </div>
          <div class="topItem">
            <div class="ordertitle">今日可配</div>
            <div class="orderSize">{{ jrwfhover }}</div>
          </div>
        </div>
      </div>
      <div class="unfinished">
        <div class="secondItem">
          <div class="secondTitle">二楼库内作业情况(未外复完成)</div>
          <div
            class="secondContent"
            v-for="(item, index) in twoNotover"
            :key="index"
          >
            <div class="name">{{ item.codeDescr }}</div>
            <div class="num">{{ item.orderSum }}</div>
          </div>
        </div>
        <div class="secondItem1">
          <div class="secondTitle">三楼库内作业情况(未外复完成)</div>
          <div
            class="secondContent"
            v-for="(item, index) in threeNotover"
            :key="index"
          >
            <div class="name">{{ item.codeDescr }}</div>
            <div class="num">{{ item.orderSum }}</div>
          </div>
        </div>
        <div class="secondItem2">
          <div class="secondTitle">三楼其他库内作业情况(未外复完成)</div>
          <div
            class="secondContent"
            v-for="(item, index) in threeOthernotover"
            :key="index"
          >
            <div class="name">{{ item.codeDescr }}</div>
            <div class="num">{{ item.orderSum }}</div>
          </div>
        </div>
      </div>
    </div>
    <!-- 总可配订单数 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="500px"
      :close-on-click-modal="false"
      custom-class="container"
    >
      <div v-loading="rloading">
        <div v-for="(item, index) in routerSum" :key="index" class="routerdig">
          <div class="routertext">{{ item.codeDescr }}</div>
          <div class="routerNum">{{ item.orderSum }}</div>
        </div>
      </div>
    </el-dialog>
    <!-- 昨日可配 -->
    <el-dialog
      :title="availabletitle"
      :visible.sync="availableDialog"
      width="650px"
      :close-on-click-modal="false"
      custom-class="acontainer"
    >
      <el-table
        :data="tableData"
        style="width: 100%; height: 560px; overflow-y: auto"
        v-loading="aloading"
      >
        <el-table-column
          prop="customerid"
          label="客户编号"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="orderno"
          label="订单号"
          align="center"
          width="180"
        ></el-table-column>
        <el-table-column
          prop="consigneename"
          label="客户名称"
          align="center"
          width="270"
        >
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import {
  listMarket,
  listrouterMarket,
  listyesAvailable,
} from "@/api/subSystem/workday";
export default {
  //   dicts: ["agv_tasktype"],
  data() {
    return {
      // 昨日可配
      availableDialog: false,
      availabletitle: "昨日可配数据统计",
      tableData: [],
      aloading: false,
      // 是否显示弹出层
      open: false,
      title: "总可配订单线路统计",
      routerSum: [],
      rloading: false,
      // 总条数
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        areaNo: null,
      },
      loading: false,
      // 总任务订单数
      taskSum: "",
      // 总可配订单数
      zrsum: "",
      //  昨日待配
      zrdp: "",
      // 昨日可配
      zrwfhover: "",
      // 今日待配
      jrdp: "",
      // 今日可配
      jrwfhover: "",
      //   二楼作业情况
      twoNotover: [],
      // 三楼作业情况
      threeNotover: [],
      // 三楼其他库内
      threeOthernotover: [],
      // 定时器
      interval:null,
    };
  },
  mounted() {
    this.handleQuery();
    this.interval = setInterval(() => {
            location.reload();
        }, 120000);
  },
  beforeDestroy(){
    clearInterval(this.interval);
  },
  methods: {
    // 总可配订单数
    handleSum() {
      this.open = true;
      this.rloading = true;
      listrouterMarket().then((res) => {
        this.routerSum = res.lxSum;
        this.rloading = false;
      });
    },
    // 昨日可配
    handleYesavailable() {
      this.availableDialog = true;
      this.aloading = true;
      listyesAvailable().then((response) => {
        this.tableData = response.zrxx;
        this.aloading = false;
      });
    },
    goBack() {
      this.$router.push("/subSystem1");
    },
    // 重置
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleQuery() {
      this.loading = true;
      listMarket().then((res) => {
        this.taskSum = res.TaskSum;
        this.zrsum = res.zrSum;
        this.zrdp = res.Zrdp;
        this.zrwfhover = res.ZrWfhOver;
        this.jrdp = res.Jrdp;
        this.jrwfhover = res.JrWfhOver;
        this.twoNotover = res.TwoNotOver;
        this.threeNotover = res.ThreeNotOver;
        this.threeOthernotover = res.ThreeOtherNotOver;
        this.loading = false;
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.app-container {
  min-height: 1080px;
  background: #024b51;
  ::v-deep .container .el-dialog__body {
    min-height: 250px;
  }
  ::v-deep .acontainer .el-dialog__body {
    max-height: 600px;
  }
  ::v-deep .container .routerdig {
    width: 100%;
    height: 50px !important;
    display: flex;
    justify-content: space-around;
    background: #989af7;
    color: #000000;
  }
  ::v-deep .container .routertext {
    width: 50%;
    line-height: 50px;
    text-align: center;
  }
  ::v-deep .container .routerNum {
    width: 50%;
    text-align: center;
    line-height: 50px;
  }
  ::v-deep .container .routertext,
  .routerNum {
    font-size: 25px;
    border: 1px solid #ebe2e2;
  }
  .el-icon-data-analysis::before {
    color: #00d9ff;
    margin-right: 8px;
  }
  .title1 {
    font-size: 16px;
    // margin-bottom: 15px;
    color: #ffffff;
    width: 220px;
    padding: 5px;
    border-bottom: 1px dotted #8ddfff;
  }
  .header {
    margin-top: -10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .el-date-editor.el-input,
    .el-date-editor.el-input__inner {
      width: 220px;
      margin-right: 20px;
    }

    .backB {
      cursor: pointer;

      img {
        width: 20%;
      }
    }
  }
  //   .formCenter {
  //     height: 62px;
  //     display: flex;
  //     justify-content: center;
  //     align-items: center;
  //     margin-bottom: 10px;
  //   }
  .content {
    width: 100%;
    height: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #024b51;
    .marketTitle {
      width: 100%;
      text-align: center;
      font-size: 30px;
      color: #fff;
    }
    .taskOrder {
      width: 80%;
      height: 200px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      margin-top: 50px;
      background: #26ccd8;
      font-weight: 700;
      border-top: 1px solid #fff;
      border-left: 1px solid #fff;
      .oderItem {
        width: 33.3%;
        height: 200px;
        display: flex;
        flex-direction: column;
        .topItem {
          display: flex;
          width: 100%;
          height: 100px;
          border-right: 1px solid #fff; /* 右边框 */
          border-bottom: 1px solid #fff; /* 下边框 */
          .ordertitle {
            width: 35%;
            height: 100%;
            display: flex;
            justify-content: center;
            border-right: 1px solid #fff; /* 右边框 */
            align-items: center;
            font-size: 20px;
            color: #ffffff;
          }
          .orderSize {
            width: 65%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 40px;
            color: #fff;
            cursor: pointer;
          }
        }
      }
      //   .oderItem {
      //     width: 16.7%;
      //     text-align: center;
      //     height: 200px;
      //     line-height: 200px;
      //     border-right: 1px solid #fff; /* 右边框 */
      //     border-bottom: 1px solid #fff; /* 下边框 */
      //     .ordertitle {
      //       height: 100px;
      //       line-height: 100px;
      //       border-bottom: 1px solid #fff;
      //     }
      //     .orderSize {
      //       font-size: 70px;
      //       color: #fff;
      //     }
      //   }
    }

    .unfinished {
      width: 80%;
      height: 600px;
      display: flex;
      justify-content: space-around;
      margin-top: 50px;

      .secondItem {
        background: #50c48f;
        font-size: 18px;
      }
      .secondItem1 {
        background: #f7b13f;
        font-size: 18px;
      }
      .secondItem2 {
        background: #b699fd;
        font-size: 18px;
      }
      .secondItem,
      .secondItem1,
      .secondItem2 {
        width: 33.3%;
        height: 100%;
        .secondTitle {
          height: 10%;
          display: flex;
          align-items: center;
          justify-content: center;
          border: 1px solid #fff;
          font-weight: 700;
          font-size: 22px;
          color: #fff;
        }
        .secondContent {
          height: 11.25%;
          width: 100%;
          display: flex;
          justify-content: space-around;
          border-left: 1px solid #fff;
          .name,
          .num {
            width: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            border-right: 1px solid #fff; /* 右边框 */
            border-bottom: 1px solid #fff; /* 下边框 */
          }
          .name {
            font-size: 18px;
          }
          .num {
            font-size: 30px;
            font-weight: 700;
            color: #fff;
          }
        }
      }
    }
  }
}
</style>